package com.sh.data.engine.domain.common.model.domain;

import lombok.Data;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author: zigui.zdf
 * @description:
 * @date: 2020/11/11 15:42
 */
@Data
public class DataApiKey implements Serializable {

    private static final long serialVersionUID = 517235908672005195L;

    private Long apiId;
    private String apiPath;

    public DataApiKey(Long apiId, String apiPath) {
        this.apiId = apiId;
        this.apiPath = apiPath;
    }

    public static DataApiKey of(Long apiId, String apiPath) {
        DataApiKey key = new DataApiKey(apiId, apiPath);
        return key;
    }

    @Override
    public int hashCode() {
        return Objects.hash(apiId, apiPath);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || !(obj instanceof DataApiKey)) {
            return false;
        }
        DataApiKey that = (DataApiKey) obj;
        return Objects.equals(apiId, that.apiId) && Objects.equals(apiPath, that.apiPath);
    }
}
